#define _CRT_SECURE_NO_WARNINGS
#include <stack>
#include <iostream>
using namespace std;
class MinStack {
    stack<int> minStack;
    stack<int> normalStack;
public:
    MinStack() {

    }

    void push(int val) {
        if (normalStack.empty() || val <= minStack.top())
        {
            minStack.push(val);
        }
        normalStack.push(val);
    }

    void pop() {
        if (minStack.top() == normalStack.top())
        {
            minStack.pop();
        }
        normalStack.pop();
    }

    int top() {
        return normalStack.top();
    }

    int getMin() {
        return minStack.top();
    }
};

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack* obj = new MinStack();
 * obj->push(val);
 * obj->pop();
 * int param_3 = obj->top();
 * int param_4 = obj->getMin();
 */
int main()
{
    MinStack ms;
    ms.push(1);
    ms.push(-2);
    ms.push(5);
    ms.push(-10);
    cout << ms.getMin() << endl;
    ms.pop();
    cout << ms.getMin() << endl;
    return 0;
}